<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@page import="com.pojo.User"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

    <head>
		<title>登录</title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        
        <script type="application/x-javascript">
        addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); }
	</script>

	<!-- //Meta-Tags -->

	<!-- Style --> <link rel="stylesheet" href="css/style.css" type="text/css" media="all">
	<body>

	<h1>登录</h1>

	<div class="container w3layouts agileits">

		<div class="register w3layouts agileits">
			<h2>登 录</h2>
			<form action="../controller/login_check.jsp" onsubmit="return checkAll()" method="post">
				<div><span  id="demo1" style="color:red;"></span></div>
				<input type="text" Name="userPhone" id="userPhone" placeholder="手机号码"   autocomplete="off">
				<div><span  id="demo2" style="color:red;"></span></div>
				<input type="password" Name="userPsw" id="userPsw" placeholder="密码"  onclick="clicks3()" autocomplete="off">
				<div><span  id="demo3" style="color:red;"></span></div>

			<div  style="text-align:center;" class="send-button w3layouts agileits">
<%
			       Integer countx = (Integer)session.getAttribute("countx");
			       if( countx==null || countx==0){
				%>
		
				<%
				}
				else if(countx==2){
				%>
				<p style="color:red;font-size:12px;">登录失败</p>
				<%
				}
				else{
				%>
				<div style="display:none;">
				
				</div>
				<%
				}
				%>
					<input type="submit" onclick="clicks2()" value="登录" autocomplete="off" formnovalidate>

			</div>
			</form>
			<div style="text-align:right;">
			<a  href="#">忘记密码?</a>
			&nbsp;<span style="color:white;">/</span>
			<a  href="register.jsp">立即注册></a>
			</div>
			<div class="clear"></div>
		</div>


		<div class="clear"></div>

	</div>
<script>
    function clicks3(){
    	  var x=document.getElementById("userPhone").value;
          var y = document.getElementById('demo1');
          if(x == '' || x == undefined || x == null){
              y.innerHTML = "手机号不能为空";
              return false;
          }
          else if(x.length!=11){
              y.innerHTML = "手机号格式错误 ";
              return false;
          }
          else{
              y.innerHTML = "  ";
              return true;
    }
          }
    function clicks2(){
        var x=document.getElementById("userPsw").value;
        var y = document.getElementById('demo2');
        if(x == '' || x == undefined || x == null){
            y.innerHTML = "密码不能为空";
            return false;
        }
        else if(x.length<6){
            y.innerHTML = "密码至少6个字符 ";
            return false;
        }
        else{
            y.innerHTML = "  ";
            return true;
        }
    }
    function checkAll(){
        var a = clicks3();
        var b = clicks2();
        var y = document.getElementById('demo3');
        if(a&&b){
            return true;
        }
        else{
            y.innerHTML = "账号或密码错误,登录失败 ！";
            return false;
        }

    }
</script>
    </body>
</html>